package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum OrderGoodsStatus {
	
	BUY(0,"购买"),
	REFUND(1,"申请退款"),
	REFUND_SUCCESS(2,"退款成功"),
	ESTIMATE(3,"已评论"),
	REFUND_FAIL(4,"退款失败");

	private Integer value;
	private String text;

	private OrderGoodsStatus(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public int toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static OrderGoodsStatus toStatus(int value) {
		if (BUY.value == value) {
			return BUY;
		} else if (REFUND.value == value) {
			return REFUND;
		} else if (REFUND_SUCCESS.value == value) {
			return REFUND_SUCCESS;
		} else if (ESTIMATE.value == value) {
			return ESTIMATE;
		} else {
			throw new InvalidArgumentException("Unknown OrderGoodsStatus[" + value + "].");
		}
	}
}